<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>定位</title>
   <style>
       #box1{
           background-color: skyblue;
           width: 100px;
           height: 100px;

           left: 200px;
           top:300px;
           position: fixed;

       }
       #box2{
           background-color: hotpink;
           width: 100px;
           height: 100px;
           position: relative;
           left:300px;

       }



   </style>
</head>
<body>
   <div id="box1">1

   </div>
<div id="box2">2
<div style="width: 300px;height: 1000px">

</div>
</div>
</body>
</html>